package com.jmpt.fangbohui.ui.holder;

import android.content.Context;
import android.text.TextUtils;
import android.view.View;
import android.widget.TextView;

import com.jmpt.fangbohui.R;
import com.jmpt.fangbohui.bean.BrokerOrderBean;
import com.jmpt.fangbohui.ui.base.BaseViewHolder;
import com.lidroid.xutils.ViewUtils;
import com.lidroid.xutils.view.annotation.ViewInject;

public class BrokerOrderItemHolder extends BaseViewHolder<BrokerOrderBean> {
	
	@ViewInject(R.id.tv_order_item_orderId)
	private TextView mTvOrderId;
	
	@ViewInject(R.id.tv_order_item_orderState)
	private TextView mTvOrderState;
	
	@ViewInject(R.id.tv_order_title)
	private TextView mTvTitle;
	
	@ViewInject(R.id.tv_order_buyerName)
	private TextView mTvBuyerName;
	
	@ViewInject(R.id.tv_order_buyerTel)
	private TextView mTvBuyerTel;
	
	@ViewInject(R.id.tv_order_salePrice)
	private TextView mTvSalePrice;
	
	@ViewInject(R.id.tv_order_salePriceType)
	private TextView mTvSalePriceType;
	
	@ViewInject(R.id.tv_order_unitPrice)
	private TextView mTvUnitPrice;
	
	@ViewInject(R.id.tv_order_unitPriceType)
	private TextView mTvUnitPriceType;
	
	@ViewInject(R.id.tv_order_room)
	private TextView mTvRoom;
	
	@ViewInject(R.id.tv_order_hall)
	private TextView mTvHall;
	
	@ViewInject(R.id.tv_order_area)
	private TextView mTvArea;
	
	@ViewInject(R.id.tv_order_payment)
	private TextView mTvPayment;
	
	@ViewInject(R.id.tv_order_time)
	private TextView mTvTime;

	public BrokerOrderItemHolder(Context context) {
		super(context);
	}

	@Override
	protected View initView() {
		View view = View.inflate(mContext, R.layout.item_broker_order, null);
		ViewUtils.inject(this,view);
		return view;
	}

	@Override
	protected void refreshView(BrokerOrderBean data) {
		mTvOrderId.setText(data.OrderNum);
		mTvOrderState.setText(data.Order_Status);
		mTvTitle.setText(data.H_Title);
		mTvBuyerName.setText(data.BuyerName);
		mTvBuyerTel.setText(data.BuyerTel);
		mTvSalePrice.setText(data.H_SalePrice);
		mTvSalePriceType.setText(data.Saleprice_type);
		mTvUnitPrice.setText(data.H_SaleUnitPrice);
		mTvUnitPriceType.setText(data.SaleUnitPrice_type);
		if(!TextUtils.isEmpty(data.H_Room)){
			mTvRoom.setText(data.H_Room + "室");
		}
		if(!TextUtils.isEmpty(data.H_Hall)){
			mTvHall.setText(data.H_Hall + "厅");
		}
		if(!TextUtils.isEmpty(data.H_MJ)){
			mTvArea.setText(data.H_MJ + " 平方米");
		}
		if(!TextUtils.isEmpty(data.H_payment)){
			mTvPayment.setText(data.H_payment + "%");
		}
		mTvTime.setText(data.AddDate);
	}

}
